Skip to content

Instantly share code, notes, and snippets.

View zackexplosion's full-sized avatar
🏠
Working from home

Zack zackexplosion

🏠
Working from home
View GitHub Profile
<?php
$ENV = 'development';
if($ENV == 'production'){
$VERSION = '20150601';
}else{
$VERSION = time();
}
?>
<html>
@zackexplosion
zackexplosion / gist:8b1b96663a93129c741c
Created June 1, 2015 07:23
simple javascript version cache control
var ENV = 'production';
var version = Date.now();
if(ENV == 'production'){
version = '20150601';
}
var url = 'https://gist.github.com/cstony0917/425c39beb6ec83662e26.js';
$.ajax(url + '?v=' + version);
@zackexplosion
zackexplosion / gulpfile.js
Created June 21, 2015 05:35
plugins.js not build
// generated on 2015-06-14 using generator-gulp-webapp 1.0.0
import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import browserSync from 'browser-sync';
import del from 'del';
import {stream as wiredep} from 'wiredep';
const $ = gulpLoadPlugins();
const reload = browserSync.reload;
require "net/http"
require "uri"
require "random-word"
# enter your hook
hook = ""
uri = URI.parse(hook)
var is_android = navigator.userAgent.toLowerCase().indexOf('android') !== -1;
var is_ios = /iphone|ipad|ipod/i.test( navigator.userAgent);
var link;
var links = {
android : 'https://play.google.com/store?hl=zh-TW',
ios: 'https://itunes.apple.com/tw/genre/ios/id36?mt=8',
default: 'http://google.com'
};
@zackexplosion
zackexplosion / Setting up Google Cloud Storage with CORS for Web Fonts.md
Last active September 16, 2015 02:44 — forked from mhulse/Setting up Google Cloud Storage with CORS for Web Fonts.md
Setting up CORS on Google Cloud Storage: An unofficial quick start guide to serving web fonts from Google's cloud. (I'm sure a lot of this info could be improved... Please leave comments if you have tips/improvements.)

Login:

Google Cloud Storage

You'll want to login using an official Google account (i.e. if this is for your company, use the comapany Gmail account vs. a personal one.)

When logging in, you might be prompted to verify the account; if so, enter your cell number to get a verification e-mail or phone call.

Once verified, you'll have to agree to the terms of service; do that, and click continue.

@zackexplosion
zackexplosion / sample.js
Created September 11, 2015 07:11
Sample javascript object params
var init = function(options){
if(typeof options !== 'object'){
options = {};
}
options.a = options.a || '';
options.b = options.b || '';
options.c = options.c || '';
}
var my_init = new Init({
@zackexplosion
zackexplosion / echo_branches
Created September 25, 2015 03:27
echo git branches with json
function echo_branches(){
// branches, bs
$bs = shell_exec('git branch');
$bs = explode(PHP_EOL, $bs);
// output
$o = array();
foreach ($bs as $k => $b) {
if( strlen($b) <= 0 ){
@zackexplosion
zackexplosion / model.rb
Last active October 14, 2015 02:19 — forked from minjindang/請問要怎麼實作Model?
Ruby on Rails
# Try to create a "Person" model,that we can use the "children" method below.
tom = Person.create(name: "Tom")
may = Person.create(name: "May", parent: tom)
syd = Person.create(name: "Syd", parent: tom)
tom.children.map(&:name)
# => ["Syd", "May"]
# Furthermore,can you design "grandchildren" method that we can use it like this?
wen = Person.create(name: "Wen", parent: syd)
jon = Person.create(name: "Jon", parent: may)
tom.grandchildren.map(&:name)
// reference http://stackoverflow.com/questions/3653065/get-local-ip-address-in-node-js
var express = require('express');
var app = express();
var os = require('os');
var ifaces = os.networkInterfaces();
app.get('/', function (req, res) {
res.send('Hello World!');
});