Skip to content

Instantly share code, notes, and snippets.

@dgeibi
dgeibi / normal.js
Last active May 1, 2024 21:16
[ES6 Class]
class Point {
set X(v) {
this.x = v;
}
get X() {
return this.x;
}
getX() {
console.log(this.X);
}
@wuchengwei
wuchengwei / NodeJS - Http Post.js
Created December 26, 2011 08:34
NodeJS - Http Post
//doHttpPost('localhost', 8000, '/TestPost', 'string' , 'TestTestTestTest', false);
//doHttpPost('localhost', 8000, '/TestPost', 'file' , '/Users/chengwei/Downloads/grid1.png', true);
function doHttpPost(_host, _port, _path, name, value, isFile, fileEncoding) {
var http = require('http'),
fs = require('fs'),
path = require('path'),
boundary = Math.random(),
postData, postOptions, postRequest;
{
"require": {
"slim/slim": "2.*",
"illuminate/database": "*",
"dhorrigan/capsule": "*"
}
}
@fta2012
fta2012 / DragTransform
Last active May 1, 2024 21:15
Slightly modified compiled coffeescript from this codepen: http://codepen.io/fta/pen/ifnqH. Paste into console on a page that has jQuery to load the two dependent libraries (jquery-ui and numericjs). Then call makeTransformable('#selector-name') to make that element WYSIWYG editable. Use inspector to get the CSS for the transforms.
var selector = 'img' // Replace this with the selector for the element you want to make transformable
jQuery.getScript('//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', function() {
jQuery.getScript('//cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js', function() {
(function() {
var $, applyTransform, getTransform, makeTransformable;
$ = jQuery;
@nkbt
nkbt / .eslintrc.js
Last active May 1, 2024 21:15
Strict ESLint config for React, ES6 (based on Airbnb Code style)
{
"env": {
"browser": true,
"node": true,
"es6": true
},
"plugins": ["react"],
"ecmaFeatures": {
@toto-castaldi
toto-castaldi / 3d-mesh-scaling-with-tween.html
Last active May 1, 2024 21:15
three.js mesh sphere scaling with Tweens
<body></body>
<script src="http://gamingJS.com/Three.js"></script>
<script src="http://gamingJS.com/ChromeFixes.js"></script>
<script src="http://gamingJS.com/Tween.js"></script>
<script>
var scene = new THREE.Scene();
var width = window.innerWidth - 20;
var height = window.innerHeight - 20;
// children propType
Foo.propTypes = {
children: PropTypes.oneOfType([
PropTypes.arrayOf(React.PropTypes.node),
PropTypes.node
])
}
// use react router in a component (if you have to)
import withRouter from 'react-router/lib/withRouter';
/**
* braces/brackets/parentheses validator
*/
function check(str) {
const closers = {
')' : '(',
'}' : '{',
']' : '['
};
const openers = {
@jmsdnns
jmsdnns / jd-export.jsx
Last active May 1, 2024 21:14
Illustrator script—Exports CMYK, RGB, and Hex values for all the color swatches in a document. CMYK to RGB conversion using Adobe’s default US Web Coated SWOP2 to sRGB.
/**
* jd-export.jsx
* -------------
* Illustrator script—Exports CMYK, RGB, and Hex values for all the color
* swatches in a document. CMYK to RGB conversion using Adobe’s default US
* Web Coated SWOP2 to sRGB.
*
*
* LICENSE
* -------