Skip to content

Instantly share code, notes, and snippets.

View dd1994's full-sized avatar
💭
I may be slow to respond.

JIANG Di dd1994

💭
I may be slow to respond.
View GitHub Profile
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 14,
"ignored_packages":
[
"Vintage"
],
"save_on_focus_lost": true,
"tab_size": 2,
@dd1994
dd1994 / http_get.rb
Created June 20, 2015 03:48
ruby http get example
require "net/http"
require "json"
news_string = Net::HTTP.get(URI('http://node-hnapi.herokuapp.com/news'))
news = JSON.parse(news_string)
puts news
@dd1994
dd1994 / http-get.js
Created June 20, 2015 03:47
node http.get example
'use strict';
let http = require('http');
let hnApi = 'http://node-hnapi.herokuapp.com/news';
let news = '';
let hackerNews;
let req = http.get(hnApi, function(res) {
res.on('data', function(chunk) {
news += chunk;
@dd1994
dd1994 / install.md
Last active August 29, 2015 14:20 — forked from galulex/install.md

Developer libs

mysql, rmagic, curl, git, vim, sqlite, nodejs nokogiri...

sudo apt-get install libxslt1-dev libxml2-dev libmagickwand-dev imagemagick libsqlite3-dev libcurl4-openssl-dev curl git git-gui vim-gtk exuberant-ctags nodejs nodejs-legacy rar

Ruby

sudo apt-get install python-software-properties

sudo apt-add-repository ppa:brightbox/ruby-ng

@dd1994
dd1994 / subl_plugin.md
Last active August 29, 2015 14:19
my sublime plugins
  • elixir
  • gitgutter
  • SideBarEnhancements
  • HTML5
  • All Autocomplete
  • Pretty JSON
  • Java​Script & Node​JS Snippets
  • gitsavvy
  • Sublime-JSHint
  • better coffeescript
module Enumerable
def i_each_slice(n, &block)
raise "invalid slice size" if n <= 0
i, ary = 0, []
each do |a|
ary << a
i += 1
if i >= n
#!/bin/bash
# Pull this file down, make it executable and run it with sudo
# wget https://gist.githubusercontent.com/bryanhunter/10380945/raw/build-erlang-17.0.sh
# chmod u+x build-erlang-17.0.sh
# sudo ./build-erlang-17.0.sh
if [ $(id -u) != "0" ]; then
echo "You must be the superuser to run this script" >&2
exit 1
fi
#include <iostream>
using namespace std;
// big -> small
void BubbleSort(int a[]) {
int i, j, temp;
for (i = 0; i < 3; i++) {
for (j = i + 1; j < 4 ; j++) {
if (a[i] < a[j]) {
@dd1994
dd1994 / Rakefile
Last active August 29, 2015 14:12 — forked from twistedmind/Rakefile
directory "tmp"
file "tmp/hello.tmp" => "tmp" do
sh "echo 'Hello' > 'tmp/hello.tmp'"
end
task :default => 'morning:turn_off_alarm'
namespace :morning do
desc "Turn off alarm."