Skip to content

Instantly share code, notes, and snippets.

View luwes's full-sized avatar
🙇‍♂️

Wesley Luyten luwes

🙇‍♂️
View GitHub Profile
@sankage
sankage / function.coffee
Created April 3, 2012 18:07
CoffeeScript: self executing anonymous functions
# Is there a coffeescript way of doing this?
(function($, exports){
# doing random stuff here
})(jQuery, window);
# Other than this:
( ($, exports) ->
# doing random stuff here
@aliang
aliang / reserved_name_validator.rb
Created December 30, 2010 23:49
validate reserved names in Rails 3
# app/validators/reserved_name_validator.rb
class ReservedNameValidator < ActiveModel::EachValidator
RESERVED_NAMES = %w{
about account add admin api
app apps archive archives auth
blog
config connect contact create
delete direct_messages downloads
edit email
faq favorites feed feeds follow followers following
var gulp = require('gulp');
var browserify = require('browserify');
var handleErrors = require('../util/handleErrors');
var source = require('vinyl-source-stream');
var packageJson = require('../../package.json');
var dependencies = Object.keys(packageJson && packageJson.dependencies || {});
gulp.task('libs', function () {
@fatso83
fatso83 / gist:88370e1d75de2b9ba00b
Created March 9, 2015 16:08
Gulp config for babelify
var gulp = require('gulp');
var source = require('vinyl-source-stream'); // Used to stream bundle for further handling
var browserify = require('browserify');
var watchify = require('watchify');
var gulpif = require('gulp-if');
var uglify = require('gulp-uglify');
var streamify = require('gulp-streamify');
var notify = require('gulp-notify');
var concat = require('gulp-concat');
var cssmin = require('gulp-cssmin');
@flopezluis
flopezluis / ordered_hm.js
Created June 3, 2011 07:22
Ordered Hash Map
/*
* Simple hash map using javascript objects and an ordered array.
* Repeated elements are not allowed.
*
* @param sort_method By default is ASC order, but you can specified whatever you want.
*
* The public methods are:
* -set
* -get
* -del
@Natetronn
Natetronn / .editorconfig
Created April 16, 2015 23:15
Craft CMS Editor Config with PT Coding Standards - Find your IDE/Editor here: http://editorconfig.org/#download
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@ryanflorence
ryanflorence / Base.coffee
Created September 9, 2012 01:06
Base CoffeeScript Class, surprisingly useful.
################################################################################
# script: Base.coffee
# author: Ryan Florence <rpflorence@gmail.com>
# license: MIT-Style License
#
# A surprisingly useful base class for CoffeeScript. Inspired by my old
# friend, MooTools Class. Provides default options, mixins, and custom events.
class Base
defaults: {}
@bengillies
bengillies / Makefile
Created November 5, 2011 01:09
extract.js - extract objects from an argument list
.PHONY: test
test:
qunit test/index.html
@getify
getify / gist:675496
Created November 13, 2010 17:18
detecting if flash plugin is installed
var _flash_installed = ((typeof navigator.plugins != "undefined" && typeof navigator.plugins["Shockwave Flash"] == "object") || (window.ActiveXObject && (new ActiveXObject("ShockwaveFlash.ShockwaveFlash")) != false));
@commenthol
commenthol / promisify.js
Last active February 26, 2020 13:36
promisify
const promisify = (fn) => (
(...args) => (
new Promise((resolve, reject) => {
fn(...args, (err, ...res) => {
if (err) reject(err)
else resolve(...res)
})
})
)
)