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 Beacon = Backbone.Model.extend({ | |
defaults: { | |
name: String | |
} | |
}); | |
var Beacons = Backbone.Collection.extends({ | |
model: Beacon, | |
url: '/beacons' | |
}); |
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
# Search for a string in files | |
grep -r "findme" . | |
# List processes filtered by a string | |
ps -aux | grep httpd |
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 pages = [ | |
{id: 1, parent: null, name: 'First'}, | |
{id: 2, parent: null, name: 'Second'}, | |
{id: 3, parent: 2, name: 'First child of second'}, | |
{id: 4, parent: 2, name: 'Second child of second'}, | |
{id: 5, parent: 2}, | |
{id: 6, parent: 4}, | |
{id: 7, parent: 4}, | |
{id: 8, parent: 6} | |
]; |
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
[ | |
{ | |
"$match": { | |
"tags": { | |
"$in": [ | |
"android", | |
"apple" | |
] | |
} | |
} |
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
# Fetch all the branches and their commits from the repo | |
git fetch origin | |
# Just fetch the branches from the repo | |
git fetch -p | |
# Display the remote branches | |
git branch -r | |
# Setting a local branch remote to the one on the origin |
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 | |
$GLOBALS['__DB'] = false; | |
function collection($name = FALSE) | |
{ | |
if (!$GLOBALS['__DB']) | |
{ | |
$connection = new MongoClient("http://localhost:27017"); | |
$dbname = "database_name"; |
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
Layer = | |
getCollections: (callback) -> | |
collections = db.extractCollections() | |
return callback(collections) if collections.length | |
API.getCollections | |
success: (data) -> | |
collections = db.saveAndGetCollections data |
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
namespace HipChatter.Libs | |
{ | |
public sealed class API | |
{ | |
private static readonly API instance = new API(); | |
public ObservableCollection<Contact> Contacts = new ObservableCollection<Contact>(); | |
public ObservableCollection<Room> Rooms = new ObservableCollection<Room>(); | |
public ObservableCollection<Chat> Chats = new ObservableCollection<Chat>(); | |
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
window.onscroll = function() { | |
var top = (document.documentElement && document.documentElement.scrollTop) || document.body.scrollTop; | |
console.log(top); | |
} |
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 | |
/** | |
* PHP Cache class inspired by Rails.cache.fetch | |
* | |
* @author Nicholas Valbusa - @squallstar | |
* @copyright Copyright (c) 2014, Nicholas Valbusa | |
* @license GNU/GPL (General Public License) | |
* @link https://gist.github.com/squallstar/9093354 | |
* | |
*/ |