Skip to content

Instantly share code, notes, and snippets.

@l4u
l4u / Dockerfile
Created June 22, 2015 11:03
Rails Docker docker-compose cached gems
FROM ruby:2.2.2
RUN apt-get update -qq && apt-get install -y build-essential
# for postgres
RUN apt-get install -y libpq-dev
# for nokogiri
RUN apt-get install -y libxml2-dev libxslt1-dev
Warning: owner-based and parent-based contexts differ (values: `undefined` vs `[object Object]`) for key (muiTheme) while mounting Paper (see: http://fb.me/react-context-by-parent)
es6.promise.js:131 Unhandled promise rejection TypeError: Cannot read property 'component' of undefined
at getStyles (webpack:///./~/material-ui/lib/paper.js?:37:47)
at render (webpack:///./~/material-ui/lib/paper.js?:58:23)
at ReactCompositeComponentMixin._renderValidatedComponentWithoutOwnerOrContext (webpack:///./~/react/lib/ReactCompositeComponent.js?:789:34)
at ReactCompositeComponentMixin._renderValidatedComponent (webpack:///./~/react/lib/ReactCompositeComponent.js?:816:14)
at ReactPerf.measure.wrapper (webpack:///./~/react/lib/ReactPerf.js?:70:21)
at ReactCompositeComponentMixin.mountComponent (webpack:///./~/react/lib/ReactCompositeComponent.js?:237:30)
at ReactPerf.measure.wrapper [as mountComponent] (webpack:///./~/react/lib/ReactPerf.js?:70:21)
at Object.ReactReconciler.mountComponent (we
@l4u
l4u / gist:2f0872007626c68470f8
Last active August 29, 2015 14:20
Raspberry Pi 2
# https://wiki.ubuntu.com/ARM/RaspberryPi
# install xubuntu-desktop
# disable overscan
/boot/config.txt
# Autostart Synergy before logging in (LightDM)
/etc/lightdm/lightdm.conf:
[SeatDefaults]
greeter-setup-script=/usr/bin/synergyc <OPTIONS> <SERVER HOSTNAME>
@l4u
l4u / AppDelegate.swift
Last active August 29, 2015 14:18
Facebook-iOS-SDK v4 swift
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
}
func applicationDidBecomeActive(application: UIApplication) {
FBSDKAppEvents.activateApp()
}
func application(application: UIApplication, openURL url: NSURL, sourceApplication: String?, annotation: AnyObject?) -> Bool {
return FBSDKApplicationDelegate.sharedInstance() .application(application, openURL: url, sourceApplication: sourceApplication, annotation: annotation)
@l4u
l4u / gist:33db08ef740a599ee884
Created March 25, 2015 12:28
Save iptables rules
apt-get install iptables-persistent
@l4u
l4u / gist:542ee6439ff2cbeed6ad
Created March 25, 2015 03:26
Parse a number with NBPhoneNumberUtil in Swift
let phoneUtil = NBPhoneNumberUtil()
let phoneNumber = phoneUtil.parse(number.string, defaultRegion:"US", error:nil)
let phoneNumberInString = phoneUtil.format(nbPhoneNumber, numberFormat: NBEPhoneNumberFormatINTERNATIONAL, error: nil)
@l4u
l4u / gist:9440f62bb3ed0bb880a6
Last active January 24, 2023 04:24
Create a UIWindow programmatically without using storyboards in swift
window = UIWindow(frame: UIScreen.mainScreen().bounds)
if let window = window {
window.backgroundColor = UIColor.whiteColor()
window.rootViewController = UIViewController()
window.makeKeyAndVisible()
}
@l4u
l4u / 0_reuse_code.js
Last active August 29, 2015 14:17
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
/home/vagrant/WebChimera/src/ChimeraAPI.cpp: In member function ‘virtual FB::variant JSPlaylistItemsAPI::GetProperty(const string&)’:
/home/vagrant/WebChimera/src/ChimeraAPI.cpp:311:15: error: ‘c’ does not name a type
for( auto c : propertyName ) {
^
/home/vagrant/WebChimera/src/ChimeraAPI.cpp:319:5: error: expected primary-expression before ‘return’
return GetProperty( idx );
^
/home/vagrant/WebChimera/src/ChimeraAPI.cpp:319:5: error: expected ‘;’ before ‘return’
/home/vagrant/WebChimera/src/ChimeraAPI.cpp:319:5: error: expected primary-expression before ‘return’
/home/vagrant/WebChimera/src/ChimeraAPI.cpp:319:5: error: expected ‘)’ before ‘return’