Skip to content

Instantly share code, notes, and snippets.

View svallory's full-sized avatar
:bowtie:
Coding like there's no tomorrow

Saulo Vallory svallory

:bowtie:
Coding like there's no tomorrow
View GitHub Profile
@svallory
svallory / funding-tracker.js
Created November 3, 2014 23:19
funding-tracker.js
(function() {
// Localize jQuery variable
var jQuery;
/******** Load jQuery if not present *********/
if (window.jQuery === undefined || window.jQuery.fn.jquery !== '1.4.2') {
var script_tag = document.createElement('script');
script_tag.setAttribute("type","text/javascript");
script_tag.setAttribute("src",
@svallory
svallory / netstat -an
Created August 25, 2015 02:06
Figuring out why nginx dowsn't work on 80
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp4 0 0 192.168.25.111.58556 94.23.9.195.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58555 91.185.207.128.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58554 91.185.207.128.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58553 23.239.11.213.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58455 192.111.0.25.443 ESTABLISHED
tcp4 0 0 192.168.25.111.58452 64.233.186.95.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58441 186.215.111.105.80 ESTABLISHED
tcp4 0 0 192.168.25.111.58434 173.194.119.4.80 ESTABLISHED
@svallory
svallory / titanium-backbone_error
Created May 28, 2012 16:16
Error when trying to install titanium-backbone
npm ERR! git clone git@github.com:trabian/stitch.git Cloning into '/tmp/npm-1338221487054/1338221492364-0.7780230774078518'...
npm ERR! git clone git@github.com:trabian/stitch.git
npm ERR! git clone git@github.com:trabian/stitch.git Permission denied (publickey).
npm ERR! git clone git@github.com:trabian/stitch.git fatal: The remote end hung up unexpectedly
npm ERR! Error: `git "clone" "git@github.com:trabian/stitch.git" "/tmp/npm-1338221487054/1338221492364-0.7780230774078518"` failed with 128
npm ERR! at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/exec.js:58:20)
npm ERR! at ChildProcess.emit (events.js:70:17)
npm ERR! at maybeExit (child_process.js:362:16)
npm ERR! at Process.onexit (child_process.js:398:5)
@svallory
svallory / yiib.sh
Created July 11, 2012 05:39
Yii-boilerplate command
#!/bin/sh
repo="https://github.com/theblacksmith/yii-boilerplate.git"
project=""
template=""
function usage
{
echo "\nYii-boilerplate (by theblacksmith)\n\n"
echo "Usage:"
@svallory
svallory / gist:3246885
Created August 3, 2012 11:44
T4 Template tweak to make byte fields private and add a public bool property
void WriteProperty(CodeGenerationTools code, EdmProperty edmProperty)
{
var type = code.Escape(edmProperty.TypeUsage);
if((type == "byte" || type == "Nullable<byte>" || type == "byte?") && code.Escape(edmProperty).ToLower().StartsWith("is"))
{
var name = code.Escape(edmProperty);
name = "_" + Char.ToLower(name[0]) + name.Substring(1);
#>
private <#=type#> <#=name#> { get; set; }
@svallory
svallory / gist:3496049
Created August 28, 2012 08:05
Save image as png in .net
Image image = Image.FromStream(file.InputStream);
var path = Server.MapPath("~/App_Data/Files");
image.Save(Path.Combine(path, Path.GetFileName("test.png")), System.Drawing.Imaging.ImageFormat.Png);
@svallory
svallory / _sass_importers_importonce.rb
Last active December 11, 2015 05:08
Sass custom importer which only imports the same file once, Compass required config and patch.
##
# the ImportOnce importer itself
# colorize is used for colorized terminal output, useful for debugging, but you can strip that off
##
require 'colorize'
module Sass
module Importers
class ImportOnce < Filesystem
@svallory
svallory / extract_clone_all_script.js
Last active December 12, 2015 04:58
Generate shell script to clone all your repositories, or a configured subset of them from your GitHub Dashboard.
// Instructions:
// 1. Navigate to you GitHub dashboard, either (https://github.com or https://github.com/organizations/{org_name}
// 2. Click on "All repositories" or "Show N more repositories" to show all your repos
// 3. Open Firebug console, and paste this script. Optionally, change the options below
// 4. Run and have fun
var options = {
origin: "all", // can be: source, fork or all
visibility: "all", // can be: public, private or all
showInNewWindow: true
public IValidationResult<Relationship> Update(Relationship relationship, IUser author)
{
repository.Attach(relationship);
relationship.UpdaterId = author.Id;
relationship.DeactivatedAt = DateTime.Now;
if (relationship.IsActive)
relationship.IsActive = false;
public IValidationResult<Relationship> Update(Relationship relationship, IUser author)
{
repository.Attach(relationship);
relationship.UpdaterId = author.Id;
relationship.DeactivatedAt = DateTime.Now;
if (relationship.IsActive)
relationship.IsActive = false;