Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / bling.js
Last active February 18, 2025 14:08
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@jagwire
jagwire / gist:0129d50778c8b4462b68
Created December 11, 2014 15:12
Unity command line script to build WebGL player
//place this script in the Editor folder within Assets.
using UnityEditor;
//to be used on the command line:
//$ Unity -quit -batchmode -executeMethod WebGLBuilder.build
class WebGLBuilder {
static void build() {
string[] scenes = {"Assets/main.unity"};
@itsjavi
itsjavi / bootstrap-equal-height.css
Created June 10, 2014 16:12
Bootstrap 3 responsive equal height columns
/* From: http://www.minimit.com/articles/solutions-tutorials/bootstrap-3-responsive-columns-of-same-height */
/* columns of same height styles */
.container-xs-height {
display:table;
padding-left:0px;
padding-right:0px;
}
.row-xs-height {
display:table-row;
@rufhausen
rufhausen / Slack.php
Last active October 25, 2021 14:10
A simple class for sending a message to SlackHQ https://slack.com. Config settings in this example are coming from Laravel's Config facade. Requires Guzzle 4.x http://guzzlephp.org.
<?php
//This code is licensed under the terms of the MIT license
use GuzzleHttp\Client;
use Config; //using Laravel's Config facade
/*
|--------------------------------------------------------------------------
@itsjavi
itsjavi / jquery.skrollto.js
Created March 21, 2014 10:02
Soft scroll to an element
$.fn.skrollto = function(speed, easing) {
speed = speed ||  1000;
easing = easing || 'swing';
return $(this).each(function(i, el){
//calculate destination place
var dest = 0;
var el = $(this);
if (el.is(':hidden')) {
@sethamclean
sethamclean / walk generator
Created March 10, 2014 22:21
filepath.walk go routine generator
package main
import (
"path/filepath"
"fmt"
"os"
)
func main(){
location := "../gocode/"
@spekkionu
spekkionu / autoload.php
Created February 3, 2014 20:54
Build Slim framework as phar
<?php
require('Slim/Slim.php');
\Slim\Slim::registerAutoloader();
@itsjavi
itsjavi / emberjs_template_loader.js
Last active December 23, 2015 18:19
emberjs external template loader with callback
function loadTemplates(templates, callback) {
var _loadCount = 0;
$('body').bind('templates_loaded', callback);
if(templates.length === 0){
$('body').trigger('templates_loaded');
}else{
$(templates).each(function(i, el) {
var _tpl = $('<script>');
_tpl.attr('type', 'text/x-handlebars');
@JonoB
JonoB / gist:6637861
Created September 20, 2013 13:49
Laravel Base Model
<?php namespace Tmb;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Validation\Validator;
class BaseModel extends Eloquent
{
/**
* Error message bag
@FokkeZB
FokkeZB / index.tss
Last active January 16, 2023 09:35
Who said you can't do padding in Titanium (Alloy)?
"#wrapper": {
// Set wrapper to adjust it's size to it's contents
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
// Set stuff like borders and backgrounds on the wrapper
backgroundColor: "red"
}