Skip to content

Instantly share code, notes, and snippets.

View dsci's full-sized avatar

Daniel Schmidt dsci

  • Leipzig, Germany
View GitHub Profile
@dsci
dsci / git_patch.sh
Last active October 6, 2015 06:47
creating and applying patches
# First find the commit sha1(s).
git log
# Then, grab the commit sha1(s).
# For a patch of a single commit.
git format-patch -M -C 3cd894a1bc36867d65119b9a490a3813c0d8066a~1..3cd894a1bc36867d65119b9a490a3813c0d8066a
# Before applying, check what will be happen.
git apply --stat <PATCH_NAME>.patch
@dsci
dsci / checkout_from_different_branch.sh
Created June 8, 2012 10:24
Checkout a file from different branch
git checkout feature_branch -- file /path/fo/wanted/file
@dsci
dsci / update_all.js
Created April 24, 2012 13:24
Update all records at once in mongodb
db.measured_data.update( { "_id" : { $exists : true } }, {$set: {"serial_number": "536883257"}}, false, true);
git fetch <REMOTE_REPO> master:<YOUR_NEW_REMOTE_REPO_BRANCH>
# Now you can do
#
# git checkout <YOUR_NEW_REMOTE_REPO_BRANCH>
# git merge <YOUR_NEW_REMOTE_REPO_BRANCH>
#
# and so on ...
git tag -d v0.0.1 # deletes the tag v0.0.1 in your local repository
git push origin :refs/tags/v0.0.1 # removes the tag v0.0.1 from your remote repository
@dsci
dsci / named_functions.coffee
Created March 22, 2012 13:13
Named functions in CoffeeScript
class sum
# Summarizes two numbers.
constructor:(a,b)->
return a+b
c = sum(3,4) #=> 7
@dsci
dsci / module.coffee
Created March 14, 2012 13:45 — forked from olivoil/module.coffee
Mixins/Modules behavior in coffeescript. Thought of to be used with Backbone.js applications
# define module behavior
class Module
keywords = ['extended', 'included', 'initialize']
@extend = (obj) ->
for key, value of obj when key not in keywords
@[key] = value
obj.extended?.apply(@)
this
@dsci
dsci / singleton.js
Created March 6, 2012 07:55
overriding singletons in ExtJS4
Ext.apply(Ext.String,{
camelcase: function(str){
var splittedString = str.split("_");
return Ext.String.capitalize(splittedString[0]) + Ext.String.capitalize(splittedString[1]);
}
});
@dsci
dsci / clockwork.gemspec
Created February 28, 2012 15:59
Clockwork ... tiny Time extensions
Gem::Specification.new do |s|
s.name = 'clockwork'
s.version = '0.1'
s.platform = Gem::Platform::RUBY
s.author = 'Daniel Schmidt'
s.email = '[email protected]'
s.summary = 'Clockwork Orange'
s.description = 'Collection of Time extensions.'
s.files = ['clockwork.rb',]
@dsci
dsci / gist:1883477
Created February 22, 2012 08:56 — forked from shripadk/gist:652819
Express authentication using Redis for session store and Couchdb for database (in coffeescript!)
###
Module dependencies
###
require.paths.unshift "#{__dirname}/lib/support/express-csrf/"
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/"
express = require 'express'
app = module.exports = express.createServer()
RedisStore = require 'connect-redis'