Skip to content

Instantly share code, notes, and snippets.

View arashm's full-sized avatar
:shipit:

Arash Mousavi arashm

:shipit:
View GitHub Profile
@emad-elsaid
emad-elsaid / regex-tester.rb
Created February 27, 2014 20:46
regular expression testing playground with ruby and sinatra
require 'sinatra' # gem install sinatra --no-ri --no-rdoc
set :port, 3000
html = <<-EOT
<html><head><style>
#regex,#text{ width:100%; font-size:15px; display:block; margin-bottom:5px; }
#text{ height: 200px; }
span{ background:rgb(230,191,161); display:inline-block; border-radius:3px;}
</style></head><body>
<input id="regex" placeholder="Regex"/>
@martianboy
martianboy / generators.js
Last active August 29, 2015 14:04
Testing higher-order functions with es6 generators
/* This will run async without creating intermediate arrays. */
function* makeGeneratorFromArray(array){
var nextIndex = 0;
while(nextIndex < array.length) {
yield array[nextIndex++];
}
}
@ndreckshage
ndreckshage / application_controller.js.coffee
Last active January 4, 2016 04:39
snapsecret v2 (not everything included...)
window.SnapSecret.ApplicationController = Ember.Controller.extend
countdownWarning: false
countdown: 60
stats:
totalRead: if !!window.secretStats and !!window.secretStats.totalRead then window.secretStats.totalRead else null
totalSpilled: if !!window.secretStats and !!window.secretStats.totalSpilled then window.secretStats.totalSpilled else null
warnAtTen: (() ->
if @countdown == 10
@set 'countdownWarning', true
else if @countdown > 10
@wycats
wycats / app.js
Last active February 11, 2016 16:08
App.Router.map(function() {
this.resource('post', { path: '/posts/:post_id' });
});
App.PostRoute = Ember.Route.extend({
model: function(params) {
return this.store.find('post', params.post_id);
}
});
@timdream
timdream / README.md
Last active March 16, 2016 15:08
Build and update your own B2G build daily-ish without blow away data. Now comes with localization testing.

B2G Personal daily dogfooding instruction

This is how I generate my dogfood build, daily-ish. I do so to ensure I have (almost) total control over what goes into my phone so I could pick up the changes anytime I wanted (and indentifying the version of Gaia/Gecko I am using).

This instruction is used for Geeksphone Peak and with zh-TW locale. Replace/remove instruction for your own phone.

File locations:

  • update.sh should go to $B2G (the place you clone B2G repo with git).

Guide to loading/error events and substates

In addition to the techniques described in the Asynchronous Routing Guide, the Ember Router provides powerful yet overridable conventions for customizing asynchronous transitions between routes by making use of error and loading substates.

loading substates

@machty
machty / new-router-examples.md
Last active April 16, 2020 22:03
How to do cool stuff with the new Router API
@carols10cents
carols10cents / ruby-to-rust-cheat-sheet.md
Last active November 24, 2020 23:12
Ruby to Rust Cheat Sheet

Ruby to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in Ruby and Rust so that programmers most comfortable with Ruby can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?

Variables

Ruby:

@alex-zige
alex-zige / gist:5795358
Last active June 8, 2023 07:49
Rails Rspec API Testing Notes

Rails Rspec APIs Testing Notes

Folders Structure

  spec
  |--- apis #do not put into controllers folder. 
        |--- your_api_test_spec.rb  
  |--- controllers
  |--- models
  |--- factories
 |--- views