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
/** | |
* r-proto-class.js | |
* Ruby's semantics | |
* | |
* Features: | |
* - super calls | |
* - using Object.create for inheritance | |
* - Class.new is a wrapper over Class.allocate and Class.initialize | |
* | |
* by Dmitry Soshnikov <dmitry.soshnikov@gmail.com> |
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
angular.module('waitForAuth', []) | |
/** | |
* A service that returns a promise object, which is resolved once angularFireAuth | |
* is initialized (i.e. it returns login, logout, or error) | |
*/ | |
.service('waitForAuth', function($rootScope, $q, $timeout) { | |
var def = $q.defer(), subs = []; | |
subs.push($rootScope.$on('angularFireAuth:login', fn)); | |
subs.push($rootScope.$on('angularFireAuth:logout', fn)); |
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
// pros: does not fetch entire record set | |
// cons: grabs the last record which needs to be ignored | |
var first = true; | |
var ref = new Firebase(...); | |
ref.endAt().limit(1).on("child_added", function(snap) { | |
if( first ) { | |
first = false; | |
} | |
else { | |
console.log('new record', snap.val()); |
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
var ref = new Firebase('https://<example>.firebaseio.com/rewards').push(); | |
ref.setWithPriority({ | |
name: 'apple', | |
otherKey: 'somevalue', | |
... | |
}, 'apple', function(err) { | |
if( error ) { console.error(err); } | |
else { | |
fetchValue(); |
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
//Return IE version or if not IE return false | |
function isIE () { | |
var myNav = navigator.userAgent.toLowerCase(); | |
return (myNav.indexOf('msie') != -1) ? parseInt(myNav.split('msie')[1]) : false; | |
} | |
//Example: | |
if (isIE () == 8) { |
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
http://stackoverflow.com/questions/5060652/jquery-selector-for-input-value |
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 | |
# change docRoot | |
docRoot=~/src/shakir/ | |
for semester in */; | |
do | |
semester="${semester%?}" | |
cd "$docRoot/$semester/" | |
for branch in */; |
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
adb logcat | grep `adb shell ps | grep com.app.package | cut -c10-15` |
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
<input type="text" id="from" placeholder="Starting date dd-mm-yyyy"> | |
<input type="text" id="to" placeholder="Ending date dd-mm-yyyy"> | |
<button onclick="calculate()">Calculate</button> | |
<script> | |
function calculate(){ | |
var from = document.getElementById('from').value; | |
var to = document.getElementById('to').value; | |
from = from.split('-'); | |
var from_day = parseInt(from[0]); |
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 | |
$url = 'http://103.251.43.79/echallan/challan/models/frmgrnverificationdefacement.php'; | |
$myvars = 'GRN=KL000001500201415E&USERID=abc'; | |
$ch = curl_init( $url ); | |
curl_setopt( $ch, CURLOPT_POST, 1); | |
curl_setopt( $ch, CURLOPT_POSTFIELDS, $myvars); | |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1); | |
curl_setopt( $ch, CURLOPT_HEADER, 0); |
OlderNewer