Skip to content

Instantly share code, notes, and snippets.

View felipesabino's full-sized avatar
👨‍💻

Felipe Sabino felipesabino

👨‍💻
View GitHub Profile
@MattWalker
MattWalker / gist:6106393
Created July 29, 2013 18:17
A workaround to manage resolved dependencies between states using ui-router. Forgive any syntax blunderings, I've been in Coffeescript Land for a while.
// ResolveService.js
angular.module('module').factory("ResolveService", function($q) {
var resolved;
// Dictionary for deferred
// object lookup
resolved = {};
return {
@spite
spite / gist:90e3dbf8e117660f6788a5748ae06cad
Last active December 30, 2016 09:20
Go to https://lines.chromeexperiments.com/drag/, start the experience and run this code in the console
document.getElementById( 'loading' ).style.display = 'none';
var speed = .001; // changes the rate of rotation
var distance = 4; // changes the distance the point travels
function _update() {
bAmDrawing = true;
lastMouseX = 0; lastMouseY = 0;
var a = speed * performance.now();
var x = distance * Math.cos( a );
var y = distance * Math.sin( a );
stage.mousemove( { data: { global : { x: x, y: y } } } )
class ApplicationController < ActionController::Base
...
# FORCE to implement content_for in controller
def view_context
super.tap do |view|
(@_content_for || {}).each do |name,content|
view.content_for name, content
end
end
end
@csu
csu / gist:d22e60114051a0a182d2
Last active September 13, 2017 19:38
Deploy to Heroku/Dokku without any changes or new commits.
git commit --allow-empty -m "empty commit"
git push heroku master
git reset HEAD~
git push -f heroku master
@markalanevans
markalanevans / redis-init-rhel
Created November 3, 2011 03:22
Simple RedHat Redis init.d script
#!/bin/sh
#
# redis Startup script for Redis Server
#
# chkconfig: - 90 10
# description: Redis is an open source, advanced key-value store.
#
# processname: redis-server
# config: /etc/redis.conf
# pidfile: /var/run/redis.pid
@felipesabino
felipesabino / setup.sh
Last active April 5, 2018 19:52
Mac OS small enhancements
#!/bin/sh
# Sets Terminal to case insensitive
# http://blog.nickburwell.com/blog/2008/11/mac-os-x-terminal-case-insensitive-auto
echo "set completion-ignore-case On" >> ~/.inputrc
# Disables the creation of .DS_Store files on external volumes
# http://danilo.ariadoss.com/how-to-recursively-remove-ds_store-files-on-mac-os-x/
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
# Make Your Keyboard Keys Repeat Properly When Held Down
# http://lifehacker.com/5826055/make-your-keyboard-keys-repeat-properly-when-held-down-in-mac-os-x-lion
@drunknbass
drunknbass / EnvConfig.swift
Created June 17, 2016 04:05
Firebase stage + Prod config
import Foundation
@objc(EnvConfig)
class EnvConfig: NSObject {
#if ENVConfigStaging
class var isProduction:Bool {
return false
}
@filipemp
filipemp / swift-problem.swift
Last active January 29, 2020 10:27
Swift problem
//: Playground - noun: a place where people can play
import Foundation
// MARK: Protocols
protocol UserRequestProtocol {
var name: String { get set }
var age: Int { get set }
var password: String { get set }
var likesBacon: Bool { get set }