Skip to content

Instantly share code, notes, and snippets.

View ishikawa's full-sized avatar
🏠
Working from home

Takanori Ishikawa ishikawa

🏠
Working from home
View GitHub Profile
@vic
vic / ex14parens.rb
Created December 9, 2016 09:13
Add missing parentheses to avoid Elixir 1.4 warnings on function calls.
#!/usr/bin/env ruby
###
# This utility adds missing parentheses to single word function calls
# that are now treated as warnings on Elixir 1.4.
#
# Download this file on your project repo and execute
# ruby ex14parens.rb --help
####
require('fileutils')
@kipcole9
kipcole9 / Map.Helpers
Last active October 24, 2023 22:13
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil
@jonsuh
jonsuh / .bash_profile
Last active February 16, 2024 17:17
Bash echo in color
# ----------------------------------
# Colors
# ----------------------------------
NOCOLOR='\033[0m'
RED='\033[0;31m'
GREEN='\033[0;32m'
ORANGE='\033[0;33m'
BLUE='\033[0;34m'
PURPLE='\033[0;35m'
CYAN='\033[0;36m'
@sorenlouv
sorenlouv / cpu-intensive.js
Last active December 19, 2023 06:00
A CPU intensive operation. Use to test imitate blocking code, test WebWorkers etc.
function mySlowFunction(baseNumber) {
console.time('mySlowFunction');
let result = 0;
for (var i = Math.pow(baseNumber, 7); i >= 0; i--) {
result += Math.atan(i) * Math.tan(i);
};
console.timeEnd('mySlowFunction');
}
mySlowFunction(8); // higher number => more iterations => slower
config :my_app, :twitter_api,
client: Twitter.SandboxClient
@foozmeat
foozmeat / openssl-build.sh
Last active December 12, 2023 19:41
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@radianttap
radianttap / gist:4455176
Last active August 16, 2018 08:52
Inserting child controllers in the Auto-Layout world.
// ## inserting. this can be done in viewDidLoad
// this can be any view, here I'm adding to main view
UIView *containerView = self.view;
// load child controller
UIViewController *svc = [[UIViewController alloc] initWithNibName:nil bundle:nil];
// kill the randomness
svc.view.translatesAutoresizingMaskIntoConstraints = NO;
// add child VC to hierarchy
[self addChildViewController:svc];
// set initial rect
@mbinna
mbinna / podforceupdate.sh
Created December 4, 2012 09:43
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@ishikawa
ishikawa / llvm-core-h.diff
Created December 5, 2010 03:59
llvm-2.7 -> llvm-2.8: include/llvm-c/Core.h
--- include/llvm-c/Core.h 2010-03-04 08:51:25.000000000 +0900
+++ ../llvm-2.8/include/llvm-c/Core.h 2010-08-28 13:09:24.000000000 +0900
@@ -204,8 +204,7 @@
LLVMPointerTypeKind, /**< Pointers */
LLVMOpaqueTypeKind, /**< Opaque: type with unknown structure */
LLVMVectorTypeKind, /**< SIMD 'packed' format, or other vector type */
- LLVMMetadataTypeKind, /**< Metadata */
- LLVMUnionTypeKind /**< Unions */
+ LLVMMetadataTypeKind /**< Metadata */
} LLVMTypeKind;
@ishikawa
ishikawa / lisp.rb
Created October 30, 2010 17:35
The LISP expressed with Ruby
# lisp.rb - The LISP expressed with Ruby
#
# * Program code can be written in Ruby's data structures (Array, Symbol, ...)
# * LISP-2 (http://en.wikipedia.org/wiki/Lisp-1_vs._Lisp-2#The_function_namespace)
#
# "THE ROOTS OF LISP" by Paul Graham
# http://www.paulgraham.com/rootsoflisp.html
#
require 'strscan'