This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function php_alert($message){ | |
echo "<script type='text/javascript'>!function(){ alert('". $message . "');}()</script>"; | |
} | |
//example | |
... | |
$result = mysqli_query($someconnection, "SELECT * FROM table"); | |
if(!$result){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Class Ex. | |
var JSClass = function(args){ | |
//This is only accessible through a getter | |
var _arg = args[0]; | |
// This is accesible by json notation: jsclassInstance.jsonAttr | |
this.jsonAttr = args[1]; | |
var func = function(args){ | |
// This function either is returned or is private to the class |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This module uses &Proc.new and yield as a way to prevent passing blocks. | |
# Not tested, as included in another module, changed for gist reasons. | |
module Semaphore | |
class << self | |
attr_accessor :cluster_semaphore | |
attr_accessor :selector_semaphore | |
attr_accessor :tagging_semaphore | |
def init_semaphore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Found here: http://c2.com/cgi/wiki?PythonRubyInitializer | |
class Class | |
def initializer(*args, &b) | |
define_method(:__init_proc) {b} | |
params = args.join(", ") | |
vars = args.collect{|a| "@#{a}"}.join(", ") | |
class_eval <<-EOS | |
def initialize(#{params}) | |
#{vars} = #{params} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static const void *touchesDelegateKey = &touchesDelegateKey; | |
static void (*Original_touchesBeganMethod)(id, SEL, NSSet *, UIEvent *); | |
static void SwizzledTouchesBegan(id _self, SEL _cmd, NSSet *touches, UIEvent *event){ | |
if([_self touchesDelegate] != nil){ | |
if([[_self touchesDelegate] respondsToSelector:@selector(windowTouches:withEvent:)]){ | |
[[_self touchesDelegate] windowTouches:touches withEvent:event]; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/path/to/your/app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENVIRONMENT=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AllCops: | |
Exclude: | |
- 'spec/**/*' | |
- 'db/**/*' | |
- 'config/**/*' | |
- 'bin/**/*' | |
# Max line length is changed from default 80 | |
Metrics/LineLength: | |
Max: 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
## | |
# This file must be renamed to pre-commit without extension and | |
# added to your .git/hooks directory | |
# After that, run `chmod 755 pre-commit` to make it executable | |
$user = ENV['USER'] | |
OlderNewer