Skip to content

Instantly share code, notes, and snippets.

View mortenjust's full-sized avatar

Morten Just mortenjust

View GitHub Profile
@mortenjust
mortenjust / reset.sass
Created May 5, 2012 12:20 — forked from trey/reset.sass
Eric Meyer's reset.css in Sass. Originally by @postpostmodern.
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain) */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
#!/usr/bin/python
# TODO make range command line arguments
import sys, codecs
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) # if your terminal can't do utf-8, well...
import time
import urllib2
import BeautifulSoup
#!/usr/bin/python
# TODO make range command line arguments
import sys, codecs
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) # if your terminal can't do utf-8, well...
import time
import urllib2
import BeautifulSoup
@mortenjust
mortenjust / MJPOPSpring
Last active August 29, 2015 14:22
One-line Facebook POP animation initializer
class MJPOPSpring: POPSpringAnimation {
init(view:NSView,
propertyName : String? = nil,
toValue _toValue : AnyObject? = nil,
repeatForever _repeatForever:Bool? = nil,
repeatCount _repeatCount: Int? = nil,
springBounciness _springBounciness: CGFloat? = nil,
springSpeed _springSpeed : CGFloat? = nil,
dynamicsTension _dynamicsTension: CGFloat? = nil,
dynamicsFriction _dynamicsFriction: CGFloat? = nil,
@mortenjust
mortenjust / android-notification
Last active August 29, 2015 14:26
Android Notification
public void sendNotification(){
// set up notification
int NOTIFICATION_ID = 0;
PendingIntent activityPendingIntent = getActivityPendingIntent();
Notification n = new NotificationCompat.Builder(this)
.setContentTitle("You won!")
.setContentText("A trip to the neighbors")
.setSmallIcon(R.drawable.abc_btn_radio_material)
.setContentIntent(activityPendingIntent)
.build();
@mortenjust
mortenjust / ActivityA.java
Last active August 29, 2015 14:26
Stackoverflow answer, "Singleton in Android"
package com.example.testSingleton;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Toast;
public class ActivityA extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
@mortenjust
mortenjust / gist:3dfc8efa0aa4422a9a2b
Created August 20, 2015 16:19
After effects counter expression
// Add the following expression for Source Text (Copy the expression, Alt-Click the Source Text Stopwatch, Paste, click outside the box):
// http://www.motionscript.com/design-guide/counter.html
numDecimals = 0;
commas = true;
dollarSign = false;
beginCount = 0;
endCount = 130000;
dur = 4;
@mortenjust
mortenjust / GridActivity.java
Last active August 29, 2015 14:27 — forked from gabrielemariotti/GridActivity.java
Android Wear: How to use a simple a GridViewPager with a FragmentGridPagerAdapter.
public class GridActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.grid);
final GridViewPager mGridPager = (GridViewPager) findViewById(R.id.pager);
mGridPager.setAdapter(new SampleGridPagerAdapter(this, getFragmentManager()));
}
@mortenjust
mortenjust / android timer.java
Last active January 23, 2016 00:01
Android Timer
Runnable runnable = new Runnable() {
@Override
public void run() {
start();
Log.d(TAG, "run: runner executed after " + delay);
toggleHandler.removeCallbacks(this);
}
};
Log.d(TAG, "start: running runner now");
@mortenjust
mortenjust / gist:b569e5f7e0804a9cf3d9
Created August 24, 2015 20:21
Toast in an Android Wear fragment
Toast.makeText(getActivity().getApplicationContext(), "text", Toast.LENGTH_LONG).show();