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
module FbGraph | |
module Connections | |
module AdCampaigns | |
def ad_campaign!(options = {}) | |
ad_campaign = post(options.merge(:connection => :adcampaigns)) | |
fb_data = ad_campaign[:data]? ad_campaign[:data][:campaigns][ad_campaign[:id]] : ad_campaign | |
AdCampaign.new(ad_campaign[:id], options.merge(fb_data.symbolize_keys).merge( | |
:access_token => options[:access_token] || self.access_token | |
)) |
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 is modified version of https://github.com/gimite/web-socket-ruby/blob/master/lib/web_socket.rb | |
# | |
# Lincense: New BSD Lincense | |
# | |
require "base64" | |
require "socket" | |
require "uri" | |
require "digest/md5" |
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
~/arcturus$irb | |
>> class A | |
>> end | |
=> nil | |
>> A.methods | |
=> [:allocate, :new, :superclass, :freeze, :===, :==, :<=>, :<, :<=, :>, :>=, :to_s, :included_modules, :include?, :name, :ancestors, :instance_methods, :public_instance_methods, :protected_instance_methods, :private_instance_methods, :constants, :const_get, :const_set, :const_defined?, :const_missing, :class_variables, :remove_class_variable, :class_variable_get, :class_variable_set, :class_variable_defined?, :module_exec, :class_exec, :module_eval, :class_eval, :method_defined?, :public_method_defined?, :private_method_defined?, :protected_method_defined?, :public_class_method, :private_class_method, :autoload, :autoload?, :instance_method, :public_instance_method, :nil?, :=~, :!~, :eql?, :hash, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :frozen?, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :i |
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
function search(arr, o) { | |
var l = 0, | |
u = arr.length, | |
m; | |
while (l <= u) { | |
if (o > arr[(m = ((l + u) >> 1))]) | |
l = m + 1; | |
else | |
u = (o == arr[m]) ? -2 : m - 1; | |
} |
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
/*********************** | |
* authentications.js | |
************************/ | |
var jwt = require('jwt-simple'); | |
var crypto = require('crypto'); | |
var secret = process.env.TOKEN_SECRET || 'shhhhhhhhhh'; | |
var authHeaderName = "x-access-token"; | |
var md5Username = '21232f297a57a5a743894a0e4a801fc3'; | |
var md5Password = '9d51b3f14e6d6763bd11fd73cf470bf2'; | |
var md5 = function(str) { |
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
<!doctype html> | |
<html ng-app="myapp"> | |
<head> | |
<script src="https://maps.googleapis.com/maps/api/js"></script> | |
<script src="http://code.angularjs.org/1.2.25/angular.js"></script> | |
<script src="https://rawgit.com/allenhwkim/angularjs-google-maps/master/build/scripts/ng-map.js"></script> | |
<script> | |
var app = angular.module('myapp', ['ngMap']); | |
app.controller('MyCtrl', function($scope) { | |
$scope.positions = [ [-24,132] ,[-25,131] ,[-26,130] ]; |
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/bash | |
i=0; array=(); | |
array[(i++)]="-X POST http://my.server.com:3000/path" | |
array[(i++)]="-X GET http://my.server.com:4000" | |
for LINE in "${array[@]}" | |
do | |
curl -o /dev/null --silent --head -m 1 --write-out '%{http_code}' $LINE | |
echo " $LINE" |
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
document.addEventListener('contextmenu', function(evt) { | |
if (evt.ctrlKey) { | |
window.$0 = evt.target; | |
window.s = angular.element($0).scope(); | |
evt.preventDefault(); | |
return false; | |
} | |
}) |
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
{ | |
// JSHint Default Configuration File (as on JSHint website) | |
// See http://jshint.com/docs/ for more details | |
"regexp": true, | |
"-W065" : true, // suppress missing radix parameter warning | |
"-W089" : true, // suppress The body of a for in should be wrapped in an if statement | |
"-W030" : true, // suppress Expected an assignment or function call and instead saw an expression | |
"maxerr" : 50, // {int} Maximum error before stopping |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="angular.js"></script> | |
<script> | |
angular.module('myApp', []). | |
factory('datepicker', function($compile, $document){ | |
var datepickerEl, datepickerElCtrl; | |
return { |
OlderNewer