Skip to content

Instantly share code, notes, and snippets.

@xumx
xumx / telegram.js
Created January 29, 2016 20:19
Telegram Client for SuperScript Chat Bot
var TelegramBot = require('node-telegram-bot-api');
var superscript = require("superscript");
var mongoose = require("mongoose");
var facts = require("sfacts");
var factSystem = facts.create('telegramFacts');
mongoose.connect('mongodb://localhost/superscriptDB');
var TopicSystem = require("superscript/lib/topics/index")(mongoose, factSystem);
// TopicSystem.importerFile('./data.json', function(){ })
@saadfarooq
saadfarooq / android_replace_in_manifest.gradle
Last active March 1, 2024 15:47
Gradle function to replace a placeholder string in AndroidManifest.xml with productFlavor package name
replaceInManifest = {variant, fromString, toString ->
def flavor = variant.productFlavors.get(0)
def buildtype = variant.buildType
def manifestFile = "$buildDir/manifests/${flavor.name}/${buildtype.name}/AndroidManifest.xml"
def updatedContent = new File(manifestFile).getText('UTF-8').replaceAll(fromString, toString)
new File(manifestFile).write(updatedContent, 'UTF-8')
}
@boazsender
boazsender / grunt.js
Created February 21, 2012 00:07
Example gruntfile.
/*global config:true, task:true*/
config.init({
pkg: '<json:package.json>',
meta: {
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= template.today("m/d/yyyy") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\n" : "" %>' +
'* Copyright (c) <%= template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */'
},
# Opens the github page for the current git repository and branch in your browser
#
# based on this: http://jasonneylon.wordpress.com/2011/04/22/opening-github-in-your-browser-from-the-terminal/
# + works with current branch
# + pass file: gh foo/bar.txt #=> https://github.com/o/o/tree/master/foo/bar.txt
# + pass commit sh: gh 5116fba #=> https://github.com/o/o/commits/5116fba
#
function gh() {
giturl=$(git config --get remote.origin.url)
if [ "$giturl" == "" ]