This file contains hidden or 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
/* | |
* Client-side HTTP requests three ways, using ES6 syntax. | |
* 1. jQuery.ajax() | |
* 2. Superagent | |
* 3. Fetch API | |
* 4. Bonus helper | |
*/ | |
// 1. jQuery.ajax() | |
// http://api.jquery.com/jquery.ajax/ |
This file contains hidden or 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
""" | |
Automate loading of F-Script Anywhere into any app. | |
By Daniel Jalkut - @danielpunkass - http://indiestack.com/ | |
To set up: | |
0. Make sure you have FScript.framework installed in /Library/Frameworks (http://www.fscript.org) | |
1. Copy this script to ~/.lldb/fsa.py | |
2. Add the following to your ~/.lldbinit file: |
This file contains hidden or 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
(ns om-data.core | |
(:require [om.core :as om :include-macros true] | |
[om.dom :as dom :include-macros true] | |
[datascript :as d])) | |
(enable-console-print!) | |
(def schema {}) | |
(def conn (d/create-conn schema)) | |
This file contains hidden or 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
// Rust 0.10-pre (Tue Mar 18, 2014) | |
// $ rustc -L rust-openssl/build/ -L rust-toml/lib doing.rs | |
// assuming https://github.com/sfackler/rust-openssl is cloned and compiled, | |
// and https://github.com/mneumann/rust-tom is cloned and compiled | |
#[feature(macro_rules)]; | |
#[allow(deprecated_owned_vector)]; | |
extern crate openssl; | |
extern crate serialize; |
This file contains hidden or 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
void function() {//closure | |
var global = this | |
, _initKeyboardEvent_type = (function( e ) { | |
try { | |
e.initKeyboardEvent( | |
"keyup" // in DOMString typeArg | |
, false // in boolean canBubbleArg | |
, false // in boolean cancelableArg | |
, global // in views::AbstractView viewArg |
This file contains hidden or 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
# Change the path to match the path to your machine. | |
$mrb_path = File.expand_path("~/src/mruby") | |
$mrbc = File.join($mrb_path,"/bin/mrbc") | |
task :default do | |
# dumps the Ruby file to disk | |
File.open("mandelbrot.rb", "w"){|f| f << mandelbrot_ruby_code } | |
# creates the .c file containing mandelbrot char array for the bytecode | |
`#{$mrbc} -Bmandelbrot_bytecode ./mandelbrot.rb` | |
example_file = wrapper_code(File.read("./mandelbrot.c")) |
This file contains hidden or 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
# Vagrant is installed | |
# VirtualBox is installed | |
# pwd: ~/Vagrant | |
git clone https://github.com/jedi4ever/veewee.git | |
cd veewee/ | |
bundle install | |
git pull | |
bundle update | |
bundle exec veewee vbox templates |
This file contains hidden or 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
SimpleGeo::Client.set_credentials(ENV['SIMPLEGEO_KEY'],ENV['SIMPLEGEO_SECRET']) | |
resp = SimpleGeo::Client.geocode_from_ip() | |
options = {:num=>1} | |
place = SimpleGeo::Client.get_places(resp[:query][:latitude], resp[:query][:longitude], options) | |
phone = place[:features][0][:properties][:phone] | |
@area_code = phone[3..-10] # Phone number format: "+1 XXX XXX-XXXX" |
This file contains hidden or 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
(ns levenshtein | |
^{:doc "A purely functional implementation of the levenshtien distance in clojure"}) | |
(defn- compute-next-row | |
"computes the next row using the prev-row current-element and the other seq" | |
[prev-row current-element other-seq pred] | |
(reduce | |
(fn [row [diagonal above other-element]] | |
(let [update-val | |
(if (pred other-element current-element) |
This file contains hidden or 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
if RUBY_ENGINE == 'macruby' | |
framework 'CoreServices' | |
WATCHED_EXTS = "rb,builder,erb,nokogiri" | |
PASSENGER_RESTART_FILE = File.expand_path(File.join(File.dirname(__FILE__), "..", "tmp", "restart.txt")) | |
DELAY = 3 | |
def modified_files(path) | |
Dir.glob("#{File.expand_path(path)}/*.{#{WATCHED_EXTS}}").map do |filename| | |
begin |
NewerOlder