Skip to content

Instantly share code, notes, and snippets.

View bryanmaina's full-sized avatar

Bryan Maina bryanmaina

View GitHub Profile
@bryanmaina
bryanmaina / test
Last active August 29, 2015 14:13
Public static void main () {
}
@bryanmaina
bryanmaina / Gruntfile.js
Last active September 6, 2015 12:59 — forked from inkbase/Gruntfile.js
A Gruntfile to set up a Sass/Jade project
module.exports = function(grunt) {
// configure the tasks
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// copy from the source directory to build
copy: {
build: {
// Bonfire: Slasher Flick
// Author: @kobibr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-slasher-flick?solution=function%20slasher(arr%2C%20howMany)%20%7B%0A%20%20return%20arr.splice(howMany-arr.length%2Carr.length-howMany)%3B%0A%7D%0A%0Aslasher(%5B1%2C%202%2C%203%5D%2C%202)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
function slasher(arr, howMany) {
return arr.splice(howMany-arr.length,arr.length-howMany);
}
slasher([1, 2, 3], 2);
// Bonfire: Seek and Destroy
// Author: @kobibr
// Challenge: http://www.freecodecamp.com/challenges/bonfire-seek-and-destroy?solution=%2F*%20jshint%20esnext%3A%20true%20*%2F%0Afunction%20destroyer(arr)%20%7B%0A%20%20%27use%20strict%27%3B%0A%20%20var%20args%20%3D%20Array.prototype.slice.call(arguments)%3B%0A%20%20args.splice(0%2C1)%3B%0A%20%20for(let%20inR%20in%20arr)%20%7B%0A%20%20%20%20for(let%20inG%20in%20args)%20%7B%0A%20%20%20%20%20%20if(arr%5BinR%5D%20%3D%3D%20args%5BinG%5D)%7B%0A%20%20%20%20%20%20%20%20delete%20arr%5BinR%5D%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%7D%0A%20%20%7D%0A%20%20%0A%20%20function%20filterred%20(obj)%7B%0A%20%20%20%20return%20Boolean(obj)%3B%0A%20%20%7D%0A%20%20%0A%20%20var%20waitingRoom%20%3D%20arr.filter(filterred)%3B%0A%20%20return%20waitingRoom%3B%0A%7D%0A%0Adestroyer(%5B1%2C%202%2C%203%2C%201%2C%202%2C%203%5D%2C%202%2C%203)%3B%0A
// Learn to Code at Free Code Camp (www.freecodecamp.com)
/* jshint esnext: true */
function destroyer(arr) {
'use strict';
var args = Array
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var del = require('del');
var es = require('event-stream');
var bowerFiles = require('main-bower-files');
var print = require('gulp-print');
var Q = require('q');
var naturalSort = require('gulp-natural-sort');
var svgSprite = require("gulp-svg-sprites");
import tweepy, simplejson, urllib, os,datetime,re
#----------------------------------------------------------------
def getBitlyKey():
bu='USER'
bkey='KEY'
return bu,bkey
def getTwapperkeeperKey():
key='KEY'
Set<String> initials = Files.lines(Paths.get("e.txt")).filter(s->!s.trim().isEmpty()).map(s->s.substring(0, 1)).collect(Collectors.toSet());
package com.example.tools;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
public class ThreadStackPrinter {
private static Gson gson = new GsonBuilder()
.setPrettyPrinting()
.serializeNulls()
public final class StreamHelpers {
public static <T> Consumer<T> branch(Predicate<? super T> test,
Consumer<? super T> t,
Consumer<? super T> f) {
return o -> {
if (test.test(o)) t.accept(o);
else f.accept(o);
};
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.zip.DeflaterOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;