Skip to content

Instantly share code, notes, and snippets.

View stvnwrgs's full-sized avatar
🪁
Building something new

Steven Wirges stvnwrgs

🪁
Building something new
View GitHub Profile
@stvnwrgs
stvnwrgs / gist:1837484
Created February 15, 2012 17:32
Easy SCSS COMPASS Grid
/*
* This Grid system is following to use:
*
* edit your grid width and space width with your size
*
* use the following classes:
* "grid_$size" for a grid
* "no-pre-space" to delete the prefix space of the first grid_column
* "nosuff-space" to delete the suffix space of the last grid column
* "prefix_$size" to add a left padding before your grid
@stvnwrgs
stvnwrgs / gist:2170480
Created March 23, 2012 13:08
Takuzu generator
while (!isResultOk) {
for (int x = 0; x <= maximumCells; i++) {
for (int y = 0; y <= maximumCells;) {
Random random = new Random();
boolean a = random.nextBoolean();
cell[x][y] = a;
}
isResultOk = checkResult();
}
@stvnwrgs
stvnwrgs / flow.json
Created July 2, 2012 13:42 — forked from zubairov/flow.json
Build in Berlin Applications
{
"nodes": [
{
"title": "Wufoo Entry",
"icon": "images/icons/wufoo_64.png",
"top": 43,
"left": 140,
"compID": "wufoo_hook",
"subdomain": "elasticio",
"formID": "q7x3s5",
@stvnwrgs
stvnwrgs / flow.json
Created July 2, 2012 13:35
Untitled_0
{
"nodes": [
{
"title": "Timeline",
"icon": "images/icons/twitter_64.png",
"top": 145,
"left": 218,
"compID": "twitter",
"username": "stvnwrgs",
"backFill": "15",
@stvnwrgs
stvnwrgs / flow.json
Created July 2, 2012 13:48 — forked from drobiazko/flow.json
Instagram to Dropboxwe
{
"nodes": [
{
"title": "Instagram",
"icon": "images/icons/instagram_64.png",
"top": 136,
"left": 182,
"compID": "instagram",
"id": "step_124"
},
@stvnwrgs
stvnwrgs / gist:cf346143cf57ee76cb27
Created October 12, 2015 15:42
Bash one-liner for generating a etcd2 discovery token and replace it in a yml file
step1: res=$(curl -w "\n" 'https://discovery.etcd.io/new?size=3') => set var res = discovery url
step2: sed -i'' -e "s,discovery: \".*,discovery: \"$res\",g" coreos/etcd.yml; => replace
step3: rm coreos/etcd.yml-e; => remove to stupid backup file
res=$(curl -w "\n" 'https://discovery.etcd.io/new?size=3');sed -i'' -e "s,discovery: \".*,discovery: \"$res\",g" coreos/etcd.yml;rm coreos/etcd.yml-e;
@stvnwrgs
stvnwrgs / asd
Created November 16, 2015 19:51
asd
asd
@stvnwrgs
stvnwrgs / gist:4960618
Last active December 13, 2015 19:09
Fix for query function to use Models dbCriteria for creating query. So you can edit these criterias with beforeFind()
/**
* Performs the actual DB query and populates the AR objects with the query result.
* This method is mainly internally used by other AR query methods.
* @param CDbCriteria $criteria the query criteria
* @param boolean $all whether to return all data
* @return mixed the AR objects populated with the query result
* @since 1.1.7
*/
protected function query($criteria,$all=false)
{
@stvnwrgs
stvnwrgs / client.js
Created November 12, 2013 11:07 — forked from epadillas/client.js
// Send cookies for the socket.io handshake (sails.js)
// Based on https://gist.github.com/jfromaniello/4087861
// Socket.io open ticket (started by jfromaniello):
// https://github.com/LearnBoost/socket.io-client/pull/512
var io = require('socket.io-client');
var request = require('request');
var xhr = require('socket.io-client/node_modules/xmlhttprequest');
var xhrOriginal = require('xmlhttprequest');
@stvnwrgs
stvnwrgs / Git Status Bash scripts
Last active December 28, 2015 23:29
Get Information for contributed users of a repo
/**
* Show inserts and delets by users in a repo
*
*
**/
perl -e 'foreach(`git shortlog -s -n`){'\
'($c,$a)=$_=~/^\s*(\d+)\s*(.+?)\s*$/;$p=$m=0;'\
'foreach(`git log --author="$a" --pretty=tformat: --numstat -C`)'\
'{($pp,$mm)=$_=~/^\s*(\d+)\s+(\d+)/;$p+=$pp;$m+=$mm;}'\