Skip to content

Instantly share code, notes, and snippets.

View engincancan's full-sized avatar
🙂
I may be slow to respond.

Engin CAN engincancan

🙂
I may be slow to respond.
View GitHub Profile
@giacomopaita
giacomopaita / SASS Mixins
Last active August 29, 2015 14:07
MIxins Collection
// @include font-face($style-name, $file, $family, $category);
// $style-name being the name of the font e.g. Helvetica
// $file meaning the file name, without the file extensions
// $family being the folder inside the fonts folder where the font files are
// $category is serif or sans-serif or monospace etc. as a fall back in CSS
// Here with real values:
//
// @include font-face('Ashbury', 'AshburyLig-webfont', 'Ashbury', 'serif');
// use with iconmoon: https://icomoon.io/app/#/select/font
@fhemberger
fhemberger / talks.md
Last active August 29, 2015 14:05
FrOSCon 2014 Cologne.js JavaScript track
@esfand
esfand / typescript_angular.adoc
Last active September 30, 2022 12:37
AngularJS with TypeScript
@danharper
danharper / background.js
Last active April 29, 2025 04:09
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
@davidwkeith
davidwkeith / create_element.js
Created June 10, 2013 00:33
Example of document.createElement enhancement
// not sure how to detect this yet, stay tuned or leave a comment
window.document._createElement = window.document.createElement;
window.document.createElement = function(name, attributes) {
if (typeOf attributes === 'string') {
// Chrome adds an undefined 'is' attribute for the second arg, why is this?
// Chrome is also throwing a TypeError for any third arg I can think of (number, string, object)
return window.document._createElement(arguments);
} else {
var elm = window.document._createElement(name);
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@christopherperry
christopherperry / CheckableLinearLayout
Created September 18, 2012 22:43
A LinearLayout that implements the Checkable interface, allowing a LinearLayout to be put into a checked state.
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Checkable;
import android.widget.LinearLayout;
@ericelliott
ericelliott / flyweight-factory-module.js
Last active November 6, 2015 21:38
Flyweight Factory Module Pattern
var myPrototype = {
methodA: function methodA() {},
methodB: function methodB() {},
methodC: function methodC() {}
};
createFoo = function createFoo() {
return (Object.create(myPrototype));
};
@davidwkeith
davidwkeith / localization_helper.js
Created July 11, 2012 21:50
Localization Helper for Ember.js's Handlebars
Handlebars.registerHelper('loc', function(property, fn) {
var str;
// we are bound to a value, it is now the context
if (fn.contexts && typeof fn.contexts[0] === 'string') {
str = fn.contexts[0];
// Convention, start all localization keys with _
} else if (property[0] === '_') {
str = property;
@davidwkeith
davidwkeith / index.html
Last active November 7, 2024 19:03
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom protocol handlers. Licensed under the WFTPL http://www.wtfpl.net/txt/copying/
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>App Redirection</title>
</head>
<body>
<!--
NOTE: This was a great hack in days gone by, but now both Apple and Google have improved their support for custom
protocol handlers.