Skip to content

Instantly share code, notes, and snippets.

View crapthings's full-sized avatar
😎
🇰🇵我们晚上去

crapthings crapthings

😎
🇰🇵我们晚上去
View GitHub Profile
@jperl
jperl / gist:19d1322187b1756fe3e2
Created August 27, 2014 19:14
Grunt tasks to add and build crosswalk for cordova project using grunt shell
var crosswalk = {
folder: {
arm: 'tools/crosswalk-cordova-7.36.154.13-arm',
x86: 'tools/crosswalk-cordova-7.36.154.13-x86'
}
};
// https://crosswalk-project.org/#documentation/cordova/migrate_an_application
var addCrosswalk = {
command: [
@sidorares
sidorares / gist:4025095
Created November 6, 2012 14:41
dbus 'device added' signal listener
var dbus = require('dbus-native');
var bus = dbus.systemBus();
udservice = bus.getService('org.freedesktop.UDisks');
udservice.getInterface(
'/org/freedesktop/UDisks',
'org.freedesktop.UDisks',
function(err, ud) {
ud.on('DeviceAdded', function(deviceObjectPath) {
console.log('DeviceAdded', deviceObjectPath);
});
@brysongilbert
brysongilbert / css-gradient-mixin.less
Created October 15, 2012 20:35
LESS Mixin for CSS/SVG Vertical Gradients
// Vertical gradient using CSS where possible, and base64-encoded SVG for IE9 (enables use of this in combination with border-radius)
// Based on this by Phil Brown: http://blog.philipbrown.id.au/2012/09/base64-encoded-svg-gradient-backgrounds-in-less/
// Also based on a mixin from Twitter Bootstrap: https://github.com/twitter/bootstrap
.gradient-vertical(@startColor, @endColor) {
// IE9 prep
@dataPrefix: ~"url(data:image/svg+xml;base64,";
@dataSuffix: ~")";
@dataContent: ~'<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 1 1" preserveAspectRatio="none"><linearGradient id="g743" gradientUnits="userSpaceOnUse" x1="0%" y1="0%" x2="0%" y2="100%"><stop stop-color="@{startColor}" offset="0"/><stop stop-color="@{endColor}" offset="1"/></linearGradient><rect x="0" y="0" width="1" height="1" fill="url(#g743)"/></svg>';
#!/bin/sh
#create meteor project
mrt create "$1"
#revise priors
sudo rm "$1".js
sudo rm "$1".html
sudo rm "$1".css
@camilosw
camilosw / README.md
Last active December 22, 2015 07:18 — forked from dariocravero/README.md
Save files on Meteor. Work with version 0.6.5

Create a Meteor app and put the client_/server_ files in a client/server directories. Also, create a public dir to save the uploaded files.

@iMagdy
iMagdy / app-file-server.js
Created September 10, 2013 18:10
Meteor file upload smart package, compatible with Meteor 0.6.5+, forked from http://stackoverflow.com/a/17893456
var connect = Npm.require('connect');
RoutePolicy.declare('/my-uploaded-content', 'network');
// Listen to incoming http requests
WebApp.connectHandlers.use('/my-uploaded-content', connect.static(process.env['APP_DYN_CONTENT_DIR']));
@massenz
massenz / repset_mongo.sh
Last active March 1, 2017 12:57
Creates and initializes a MongoDb replica set: allows the user to choose the number of members and the starting port number; this should also work on a remote host, but I have only tested it so far on localhost
#!/bin/bash
#
# Starts up a MongoDB replica set
#
# There is a lot of documentation about replica sets:
#
# http://docs.mongodb.org/manual/reference/replica-configuration/
# http://docs.mongodb.org/manual/administration/replica-sets/
#
# To read data from a SECONDARY, when in the client, use:
@rhoot
rhoot / rc4.coffee
Last active July 7, 2017 04:27
Node.js RC4 encryption/decryption
###
Copyright (c) 2012 rhoot <https://github.com/rhoot>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
//top-level imports
import React from 'react';
import shallowCompare from 'react-addons-shallow-compare'
import { Link } from 'react-router';
//npm components
import { List, AutoSizer, InfiniteLoader } from 'react-virtualized';
// Material-UI
import {Card, CardActions, CardHeader, CardText} from 'material-ui/Card';
import Avatar from 'material-ui/Avatar';
//modules
@alvaropinot
alvaropinot / map-to-object.js
Created October 3, 2017 17:58
"FUNctional" 😜 Map 🗺 to object 🔑
const obj = { a: 1, c: 3, b: 2 }
// Map from object.
const myMap = new Map(Object.entries(obj))
// Map to Object.
// NOTE: Keys will be cast to strings by `.toString`, so any "complex" key like for example `[1, 2]` will become `1,2`
const newObj = [...myMap.entries()]
.reduce((acc, [key, value]) => (Object.assign(acc, { [key]: value })), {})