Skip to content

Instantly share code, notes, and snippets.

View marcelosomers's full-sized avatar

Marcelo Somers marcelosomers

View GitHub Profile
@marcelosomers
marcelosomers / git-php-webhook.php
Last active January 28, 2023 19:07
A basic webhook for deploying updates to repos on Github to your local server
<?php
/**
* This script is for easily deploying updates to Github repos to your local server. It will automatically git clone or
* git pull in your repo directory every time an update is pushed to your $BRANCH (configured below).
*
* Read more about how to use this script at http://behindcompanies.com/2014/01/a-simple-script-for-deploying-code-with-githubs-webhooks/
*
* INSTRUCTIONS:
* 1. Edit the variables below
* 2. Upload this script to your server somewhere it can be publicly accessed
/* bling.js */
window.$ = document.querySelectorAll.bind(document)
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn)
}
NodeList.prototype.__proto__ = Array.prototype
@marcelosomers
marcelosomers / challenging-class-order-01.html
Last active October 4, 2016 16:21
Code Snippets for Functional CSS post on slalom.com
<div class="flex m0 p0 md-m2 md-p2">
The breakpoints are grouped
</div>
@marcelosomers
marcelosomers / index.js
Last active September 7, 2016 14:17
Get variables from file name and rename files
var fs = require('fs')
var filepath = require('filepath')
fs.readdir('./logos', function(err, files) {
var path = filepath.newPath()
files.forEach(function(file) {
// remove the extension
var splitFile = file.split('.')
@marcelosomers
marcelosomers / tup.sh
Created January 24, 2014 15:03
Bash script to open a new terminal window in the existing window's directory
#!/bin/sh
# Stolen from stackoverflow.com/questions/1589114/opening-a-new-terminal-tab-in-osxsnow-leopard-with-the-opening-terminal-window
# Add as a file named `tup` somewhere on your $PATH (e.g., ~/bin
pwd=`pwd`
osascript -e "tell application \"Terminal\"" \
-e "tell application \"System Events\" to keystroke \"t\" using {command down}" \
-e "do script \"cd $pwd; clear\" in front window" \
-e "end tell"
> /dev/null
@marcelosomers
marcelosomers / gist:8524345
Created January 20, 2014 17:14
Parsing JSON in Ruby
<% json = File.read("data/data.json")
data = JSON.parse(json) %>
<ul>
<% data.each do |d| %>
<li><a href="<%= d["email"] %>"><%= d["name"] %></a></li>
<% end %>
</ul>
@marcelosomers
marcelosomers / serve-gemfile
Created December 20, 2013 00:52
My base gemfile for serve (http://get-serve.com/)
source 'https://rubygems.org'
gem 'serve', '1.5.2'
# TryStatic
gem 'rack-contrib'
# Use Compass and Sass
gem 'compass'
gem 'guard-livereload'
@marcelosomers
marcelosomers / serve-guardfile
Last active December 31, 2015 00:08
A base guardfile for using guard-livereload on Serve (http://get-serve.org/)
# A Guardfile for Serve (http://get-serve.org/)
guard 'livereload' do
watch(%r{views/.+\.(erb|haml|slim)$})
watch(%r{public/.+\.(css|js|html)})
watch(%r{stylesheets/.+\.(scss|sass)})
end
@marcelosomers
marcelosomers / new_laptop_setup.md
Last active December 27, 2015 12:09
New Mac Set Up
@marcelosomers
marcelosomers / SassMeister-input-HTML.html
Created November 13, 2015 02:59 — forked from csswizardry/SassMeister-input-HTML.html
Alert users about using a deprecated selector
<h1 class="foo">Lorem ipsum dolor sit amet.</h1>
<p class="error">Lorem ipsum dolor sit amet.</p>