Skip to content

Instantly share code, notes, and snippets.

View emj365's full-sized avatar
🎯
Focusing

Michael JIN emj365

🎯
Focusing
View GitHub Profile
@schmatz
schmatz / greed_ogres.js
Created June 12, 2014 18:52
Ian Elliott's CodeCombat Greed code
var base = this;
if ( !base.init ) {
// Mark that we've ran the init code
base.init = true;
// Starting frame number
base.frames = 0;
// Amount of frames per second
@mscoutermarsh
mscoutermarsh / application.rb
Created December 15, 2012 18:35
CORS - rails/grape
# Add this to your application.rb
config.middleware.use Rack::Cors do
allow do
origins '*'
# location of your API
resource '/api/*', :headers => :any, :methods => [:get, :post, :options, :put]
end
end
@emj365
emj365 / authorized_keys
Last active March 5, 2017 10:42
docker registry
no-pty,no-X11-forwarding,permitopen="127.0.0.1:5000",permitopen="127.0.0.1:8080",command="/bin/echo do-not-send-commands" ssh-rsa <key-string> <id>
@edgarsilva
edgarsilva / StandardFirmataForATH0.ino
Created July 16, 2014 18:25
Modified firmata protocol that works on the arduino YUN linux side communicating to the arduino side using the ttyATH0 serialport interface.
/*
* Firmata is a generic protocol for communicating with microcontrollers
* from software on a host computer. It is intended to work with
* any host computer software package.
*
* To download a host software package, please clink on the following link
* to open the download page in your default browser.
*
* http://firmata.org/wiki/Download
*/
@aliuygur
aliuygur / add-swap-file.sh
Created May 28, 2015 13:59
this file add 4GB swap file to ubuntu 14.04 x64
#!/bin/bash
sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo "/swapfile none swap sw 0 0" >> /etc/fstab
echo "Added!"
free -m
@mircobabini
mircobabini / Angular.Ionic.HardwareBackButtonManager.js
Last active November 8, 2018 08:44
HardwareBackButtonManager Service for Ionic (Angular.js) provides an interface to easily enable or disable the hardware back button on Android
.service( 'HardwareBackButtonManager', function($ionicPlatform){
this.deregister = undefined;
this.disable = function(){
this.deregister = $ionicPlatform.registerBackButtonAction(function(e){
e.preventDefault();
return false;
}, 101);
}
@Kenrick-Zhou
Kenrick-Zhou / devise.zh-CN.yml
Last active November 23, 2019 11:41 — forked from acenqiu/devise.zh-CN.yml
rails devise 3.5.2 I18n translations zh-CN
# Chinese (China) translations for Devise(3.5.2)
# by Kenrick-Zhou (https://github.com/Kenrick-Zhou)
# https://gist.github.com/Kenrick-Zhou/7909822
zh-CN:
devise:
confirmations:
confirmed: "您的帐号已经确认,您现在已登录。"
send_instructions: "几分钟后,您将收到确认帐号的电子邮件。"
send_paranoid_instructions: "如果您的邮箱存在于我们的数据库中,您将收到一封确认账号的邮件。"
@schmatz
schmatz / greed_human.js
Created June 12, 2014 18:35
Michael Heasell's CodeCombat Greed Code
// constants -------------------------------------------------------------------
var alliedTypes = {
peasant: 'peasant',
soldier: 'soldier',
knight: 'knight',
librarian: 'librarian',
griffinRider: 'griffin-rider',
captain: 'captain'
};
@kiewic
kiewic / xhubsignature.js
Created November 17, 2016 08:39
How to validate a X-Hub-Signature header when using Express.js and body-parser
var express = require('express');
var bodyParser = require('body-parser')
var crypto = require('crypto');
// Calculate the X-Hub-Signature header value.
function getSignature(buf) {
var hmac = crypto.createHmac("sha1", process.env.FB_APP_SECRET);
hmac.update(buf, "utf-8");
return "sha1=" + hmac.digest("hex");
}
@lavoiesl
lavoiesl / apache-template
Created May 7, 2012 19:24
Apache VirtualHost Template with variable replacement
<VirtualHost *:80>
ServerAdmin {USER}@cslavoie.com
ServerName {DOMAIN}
ServerAlias www.{DOMAIN}
ServerAlias {USER}.localhost
ServerAlias {USER}.static.cslavoie.com
DocumentRoot {DOC_ROOT}
<Directory {DOC_ROOT}>