Skip to content

Instantly share code, notes, and snippets.

Avatar
Brewing coffee

Abe Estrada AbeEstrada

Brewing coffee
View GitHub Profile
@leon
leon / ssh-copy-rsub
Created March 2, 2012 10:04
ssh-copy-rsub - allows you to easily copy the remote script to your server using the same syntax as ssh-copy-id
View ssh-copy-rsub
#!/bin/sh -e
#
# Usage: ssh-copy-rsub [--bash] [user@]machine
#
# Shell script to install rsub on the remove server so we can open shell scripts locally.
# Author: Leon Radley (http://github.com/leon)
URL="https://raw.github.com/avian/rmate/master/rmate"
if [ "$#" -gt 1 ] || [ "$1" = "-b" ] || [ "$1" = "--bash" ]; then
@maxparm
maxparm / is-21-years-old.js
Created April 9, 2012 17:56
JS - Is 21 Years Old?
View is-21-years-old.js
function is21YearsOld(date) {
var now = new Date();
var date = new Date(date);
var old = new Date(now.getFullYear()-21, now.getMonth(), now.getDate());
return date.getTime()<old.getTime();
}
@allanlei
allanlei / .env
Created January 16, 2012 21:14
Sample local Heroku/Django development environment using foreman
View .env
DATABASE_URL=postgres://USERNAME:PASSWORD@127.0.0.1/DATABASE
MEMCACHE_SERVERS=127.0.0.1:11211
DJANGO_SETTINGS_MODULE=settings.development.local
@olebedev
olebedev / Makefile
Last active October 25, 2016 06:35
View Makefile
PID = /tmp/awesome-golang-project.pid
GO_FILES = $(wildcard *.go)
serve:
@make restart
@fswatch -o . | xargs -n1 -I{} make restart || make kill
kill:
@kill `cat $(PID)` || true
@cem2ran
cem2ran / main.js
Created December 28, 2015 01:10
React Getting Started - How it should be!
View main.js
import React from 'react'
import ReactDOM from 'react-dom'
const Hello = ({name}) => <h1>Hello {name}!</h1>
ReactDOM.render(
<Hello name={"vjeux"}/>,
document.body.appendChild(document.createElement("div"))
)
View rpi_led.rs
#![feature(lang_items, asm)]
#![crate_type = "staticlib"]
#![no_std]
const GPIO_BASE: u32 = 0x3F000000;
const GPIO_SET: u32 = 0x3F200020;
const GPIO_CLR: u32 = 0x3F20002C;
const GPIO47: u32 = 0x8000;
fn sleep(value: u32){
@bentruyman
bentruyman / Custom.css
Created August 22, 2011 19:35
Tomorrow Theme for Chrome Developer Tools
View Custom.css
/**********************************************/
/*
/* Tomorrow Skin by Ben Truyman - 2011
/*
/* Based on Chris Kempson's Tomorrow Theme:
/* https://github.com/ChrisKempson/Tomorrow-Theme
/*
/* Inspired by Darcy Clarke's blog post:
/* http://darcyclarke.me/design/skin-your-chrome-inspector/
/*
@Yukilas
Yukilas / run.py
Created October 31, 2012 15:49
[Django, Gevent, SocketIO] Run script to automatically restart Gunicorn when a change is made on a python file
View run.py
#!/usr/bin/env python
# -*- coding:Utf-8 -*-
import os
import shlex
import subprocess
import sys
import time
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
@leipert
leipert / detectBrowserLanguage.js
Last active May 6, 2021 00:31 — forked from anonymous/detectBrowserLanguage.js
Detect browser language in javascript (utilizing lodash)
View detectBrowserLanguage.js
// These window.navigator contain language information
// 1. languages -> Array of preferred languages (eg ["en-US", "zh-CN", "ja-JP"]) Firefox^32, Chrome^32
// 2. language -> Preferred language as String (eg "en-US") Firefox^5, IE^11, Safari,
// Chrome sends Browser UI language
// 3. browserLanguage -> UI Language of IE
// 4. userLanguage -> Language of Windows Regional Options
// 5. systemLanguage -> UI Language of Windows
var browserLanguagePropertyKeys = ['languages', 'language', 'browserLanguage', 'userLanguage', 'systemLanguage'];